def test():
    from solutions.recursion import to_str, sum_list, draw

    n = 1234
    print(to_str(n, 10))
    print(to_str(n, 16), hex(n))
    print(to_str(n, 8), oct(n), "\n")

    ls = [v for v in range(5)]
    print("sum_list: %d \n" % sum_list(ls))

    import sys

    print("system recursion limit is", sys.getrecursionlimit())

    # draw()
    import turtle
    from solutions.recursion import (
        draw_spiral,
        draw_tree,
        draw_trianlge,
        sierpinski,
        sierpinski_wb,
    )

    # t = turtle.Turtle()
    # 五角星
    # draw_spiral(t, 100)

    # 分形二叉树
    # t.left(90)
    # t.penup()
    # t.backward(200)
    # t.pendown()
    # t.pencolor("green")
    # t.pensize(2)
    # draw_tree(t, 75)

    # points = {"left": (-200, -100), "top": (0, 200), "right": (200, -100)}
    # draw_trianlge(t, points, "red")
    # sierpinski(t, 5, points)
    # sierpinski_wb(t, 6, points)
    # t.hideturtle()
    # turtle.done()

    # 汉诺塔问题

    # from solutions.recursion import move_tover

    # move_tover(4, "①", "②", "③")

    # from solutions.maze import Maze, search_form

    # maze = Maze("maze.txt")
    # maze.draw_maze()
    # search_form(maze, maze.start_row, maze.start_col)
    # maze.pouse()

    # carpet(3**3, "[]")

    # from solutions.pascal_angel import pascal_angel

    # pascal_angel(8)

    from solutions.yishudadao import dp2

    dp2()


# 正方形三分之一挖空
def carpet(N, C):
    def check(n, x, y):
        if n <= 1:
            return True
        n2 = n // 3
        if n2 <= x < n2 * 2 and n2 <= y < n2 * 2:
            return False
        return check(n2, x % n2, y % n2)

    for y in range(N):
        for x in range(N):
            if check(N, x, y):
                print(C, end="")
            else:
                print(" " * len(C), end="")
        print("")
